﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class tindiaocban : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    public void TinDiaOcBan()
    {
        /*String sql;
        ConnectionData sqlconn = new ConnectionData();
        sql = "select * from tin_tuc order by id desc";

        DataSet ds = new DataSet();
        ds = sqlconn.ExecuteQuery(sql);
        dtltindiaocban.DataSource = ds;
        dtltindiaocban.DataBind();*/
    }

    protected void dtlTintucDiaoc_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        //tin moi nhat
        Image img = default(Image);
        img = (Image)e.Item.FindControl("imgHinh");
        img.ImageUrl = "~/HinhDiaOc/" + Convert.ToString(((DataRowView)e.Item.DataItem)["Hinh_Tom_Tat"]);


        /*Label tieude = default(Label);
        tieude = (Label)e.Item.FindControl("lbltieude");
        tieude.Text = Convert.ToString(((DataRowView)e.Item.DataItem)["Tieu_de"]);
        */

        HyperLink tieude = default(HyperLink);
        tieude = (HyperLink)e.Item.FindControl("hpltieude");
        tieude.Text = Convert.ToString(((DataRowView)e.Item.DataItem)["Tieu_de"]);
        tieude.NavigateUrl = "~/Chitietdiaoc.aspx?id=" + Convert.ToString(((DataRowView)e.Item.DataItem)["id"]);

        Label ndtt = default(Label);
        ndtt = (Label)e.Item.FindControl("lblNoidungtomtat");
        String nd = Convert.ToString(((DataRowView)e.Item.DataItem)["Noi_Dung_Tom_Tat"]);
        ndtt.Text = nd.Substring(0, 300) + " ...";
        //ket thuc tin moi nhat
    }

    protected void dtltindiaocban_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        dtlTintucDiaoc_ItemDataBound(sender, e);
    }
    protected void btndangnhap_Click(object sender, EventArgs e)
    {

    }
}